﻿<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
    <style>
       

        .col_window {
            width:900PX;
            height:505PX;
            margin:200PX auto;
            background-color: #11212F;
            box-shadow: 0 0 8px black;
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }
        .col_con {
            position: absolute;
            left: 0;
            width:2700PX;
            height: 340px;
            transition: left .4s ease;
        }
            .col_con > img {
                float: left;
            }
        .arrows_Lcon {
            width: 67px;
            height: 162px;
            background: rgba(0, 0, 0, 0.52);
            position: absolute;
            top: 35%;
            left: 0;
            cursor: pointer;
            display:none;
        }
        .arrows_left {
            width: 23px;
            height: 36px;
            margin: 0 auto;
            margin-top: 60px;
            background:#FFF;
        }
        .arrows_Rcon {
            width: 67px;
            height: 162px;
            background: rgba(0, 0, 0, 0.52);
            position: absolute;
            top: 35%;
            right: 0;
            cursor: pointer;
            display: none;
        }
        .arrows_right {
            width: 23px;
            height: 36px;
            margin: 0 auto;
            margin-top: 60px;
            background: #FFF;
        }
        .dots {
            width: 900px;
            height: 9px;
            margin: 0 auto;
            margin-top: 20px;
            display:flex;
            position: absolute;
            bottom: 40px;
            justify-content:center;
        }
            .dots span {
                width: 36px;
                height: 20px;
                background-color: #496274;
               
                margin-left: 10px;
                border-radius: 2px;
                cursor: pointer;
                color: transparent;
                
            }
    </style>
</head>
<body>
    <div class="col">
        <div class="col_window">
            <div class="col_con">
                <img src="https://www.jq22.com/demo/jquerylbt202112220954/images/t1.png" alt="Alternate Text" />
                <img src="https://www.jq22.com/demo/jquerylbt202112220954/images/t2.png" alt="Alternate Text" />
                <img src="https://www.jq22.com/demo/jquerylbt202112220954/images/t3.png" alt="Alternate Text" />
            </div>
            <div>
                <div class="arrows_Lcon">
                    <div class="arrows_left"></div>
                </div>
                <div class="arrows_Rcon">
                    <div class="arrows_right"></div>
                </div>
            </div>
            <div class="dots">
               
                    <span></span>
                    <span></span>
                    <span></span>
                
            </div>
        </div>
    </div>
    <script>
        let left = document.querySelector(`.arrows_Lcon`)
       
        let right = document.querySelector(`.arrows_Rcon`)
        let div1 = document.querySelector(`.col_con`)
        let div2 = document.querySelector(`.col_window`)
        let spans = document.querySelectorAll(`.dots >span`)
        let k = 0;
       
       div2.onmouseover = function () {
            right.style.display = `block`
            left.style.display = `block`
        }
        div2.onmouseout = function () {
            right.style.display = `none`
            left.style.display = `none`
        }
        
        for (let i = 0; i < spans.length; i++) {
            spans[i].onclick = function myfunction() {
               
                for (var j = 0; j < spans.length; j++) {
                    spans[j].style.background = `#496274`;
                }
                this.style.background = `#A1B5C3`
                div1.style.left = `-${900 * i}px`;
                k = i;
             }
            
        }
        console.log(k);
        for (var l = 0; l < spans.length; l++) {
            spans[l].style.background = `#496274`;
        }
        spans[k].style.background = `#A1B5C3`
        div1.style.left = `-${900 * k}px`;
        k++
        setInterval(function () {
            if (k < 3) {
                console.log(k);
                for (var l = 0; l < spans.length; l++) {
                    spans[l].style.background = `#496274`;
                }
                spans[k].style.background = `#A1B5C3`
                div1.style.left = `-${900 * k}px`;
                k++
            } else {
                k = 0;
            }
        }, 5000)
        right.onclick = function () {
            for (var j = 0; j < spans.length; j++) {
                spans[j].style.background = `#496274`;
            }

            k++;
            console.log(k);
            if (k < 3) {
                spans[k].style.background = `#A1B5C3`
                div1.style.left = `-${900 * k}px`;

            } else {
                spans[0].style.background = `#A1B5C3`
                div1.style.left = `0px`;
                k = 0;
            }
        }

        left.onclick = function () {
            for (var j = 0; j < spans.length; j++) {
                spans[j].style.background = `#496274`;
            }
            if (k == 0) {

                div1.style.left = `-1800px`;
                k = 2;
                spans[k].style.background = `#A1B5C3`
            } else if (k < 3) {

                k--;
                spans[k].style.background = `#A1B5C3`
                div1.style.left = `-${900 * k}px`;
            }
 }
    </script>
</body>
</html>